﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Bovril.Rodney.ViewModel
{
    public class Event
    {
        internal Event(Bovril.Rodney.Core.IEvent modelEvent)
        {
            modelEvent_ = modelEvent;
        }

        public String Name { get { return modelEvent_.Name; } }

        public Object[] Children
        {
            get
            {
                Core.IEvent[] childEvents = modelEvent_.GetChildEvents();
                if (childEvents.Length > 0)
                    return childEvents.Select(childEvent => new ViewModel.Event(childEvent)).ToArray();

                Core.IMarketSummary[] marketSummaries = modelEvent_.GetMarketSummaries();
                if (marketSummaries.Length > 0)
                    return marketSummaries.Select(marketSummary => new ViewModel.MarketSummary(marketSummary)).ToArray();

                return new Object[0];
            }
        }

        private Bovril.Rodney.Core.IEvent modelEvent_;
    }
}
